# From Dmitry Sorkin
[gcode_macro M900]
gcode:
  {% if 'K' in params %}
    {% if 'E' in params %}
      SET_PRESSURE_ADVANCE EXTRUDER={params.E} ADVANCE={params.K}
    {% else %}
      SET_PRESSURE_ADVANCE ADVANCE={params.K}
    {% endif %}
  {% endif %}
